﻿<%@ Page Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" 
CodeFile="Default.aspx.vb" Inherits="CricketStats_Default" title="Bridgwater Sports CC | Stats Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<%="<script type=""text/javascript"">setPopUpLoadingPage('" & Page.ResolveUrl("~/loading.aspx") & "');</script>"%>

<asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/js/modal/submodalsource.js" />
        </Scripts>
</asp:ScriptManager>
<div id="body">
    <div class="fullwidth">
        <table cellspacing="0" cellpadding="0" width="100%">
            <tr>
                <td>
                    <h2>Statistics for the <asp:Label ID="SeasonName" runat="server" /> Season</h2>
                    <br />
                    <asp:Label ID="TimeFrame" runat="server" />
                </td>
                <td align="right">
                    <asp:DropDownList ID="SeasonsDropDown" runat="server" AutoPostBack="True"></asp:DropDownList>&nbsp;
                </td>
            </tr>
            <% If IsGameRecorderOrAdmin() = True Then%>
                <tr>
                <td>
                </td>
                <td align="right">
                    <asp:Hyperlink ID="NewSeason" runat="server" Text="New Season" CssClass="submodal-400-300" NavigateUrl="~/CricketStats/newSeason.aspx"></asp:Hyperlink>
                    <% If Request("seasonid") Is Nothing = False Then%>
                    <br />
                    <asp:LinkButton ID="MarkAsCurrent" runat="server" Text="Mark As Current" />
                    <% End If %>
                </td>
            </tr>
            <% End IF %>
        </table>
    </div>
    <div id="columnleft">
        <div class="leftblock">
        <h4>Teams</h4>
        <br />
        <asp:ObjectDataSource ID="TeamListDataSource" runat="server" SelectMethod="GetSeasonTeamList" TypeName="ClubStarterKit.Web.League">
            <SelectParameters>
                <asp:Parameter Name="seasonid" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:Repeater ID="TeamListRepeater" runat="server" DataSourceID="">
            <ItemTemplate>
                <div class="teamlink">
                <asp:HyperLink ID="TeamLink" CssClass="teamLink" runat="server" Text='<%# Eval("TeamName") %>' NavigateUrl='<%# "~/CricketStats/team.aspx?teamid=" & Eval("TeamId").ToString() %>' />
                </div>
                <br />
            </ItemTemplate>
        </asp:Repeater>
        </div>
        <%If IsGameRecorderOrAdmin() Then%>
        <Club:RolloverLink ID="AddNewGameLink" runat="server" Text="New Game" NavigateURL="~/CricketStats/newgame.aspx" />
        <br />
        <asp:Hyperlink ID="AddTeam" runat="server" CssClass="submodal-200-200" Text="New Team" />
        <%End If %>
    </div>
    <div id="columnright">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="SeasonsDropDown" />
            </Triggers>
            <ContentTemplate>
                <div class="rightblock" style="">
                <h2>Games</h2><br />
                <asp:Repeater runat="server" ID="repTeamGames">
                    <ItemTemplate>
                        <asp:HiddenField ID="hidTeamId" runat="server" Value='<%# Eval("TeamId") %>' />
                        <h3><%#Eval("TeamName")%></h3>
                        <asp:GridView ID="gvGames" runat="server" DataSourceID="" AutoGenerateColumns="false" 
                            GridLines="None" Width="100%" Font-Size="12px" CellPadding="3">
                            <HeaderStyle HorizontalAlign="Left" />
                            <AlternatingRowStyle BackColor="#FFF3A5" />
                            <Columns>
                                <asp:BoundField HeaderText="" DataField="MatchDate" DataFormatString="{0:d MMM}" ItemStyle-Width="70" ItemStyle-Font-Size="10" />
                                <asp:HyperLinkField HeaderText="Versus" DataTextField="OpponentTeam" 
                                    DataNavigateUrlFields="MatchId" DataNavigateUrlFormatString="Game.aspx?id={0}" />
                                <asp:TemplateField HeaderText="H / A" ItemStyle-Width="35">
                                    <ItemTemplate>
                                        <asp:Label ID="lblHomeOrAway" runat="server" Text='<%# IIf(CBool(Eval("IsHome")), "Home", "Away")  %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="Result" DataField="Result" ItemStyle-Width="45" />
                                <asp:BoundField HeaderText="Comments" DataField="ResultComment" ItemStyle-Width="150" />
                            </Columns>
                            <EmptyDataTemplate>
                            No games stored.
                            </EmptyDataTemplate>
                        </asp:GridView>
                        <br />
                    </ItemTemplate>
                </asp:Repeater>
                
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</div>
</asp:Content>

